package com.lzj.demo.design.visitor;

import com.lzj.demo.design.visitor.user.IUser;
import com.lzj.demo.design.visitor.user.Student;
import com.lzj.demo.design.visitor.user.Teacher;
import com.lzj.demo.design.visitor.visitor.IVisitor;

import java.util.ArrayList;
import java.util.List;

/**
 * 数据看板
 * */
public class DataView {
    List<IUser> userList = new ArrayList<>();

    public DataView() {
        userList.add(new Student("JXH","大学","软件1班"));
        userList.add(new Student("LWX","大学","软件2班"));
        userList.add(new Teacher("CXF","初级教师","小学"));
        userList.add(new Teacher("WJ","高级教师","高中"));
    }
    public void show (IVisitor visitor){
        userList.forEach(x-> x.accept(visitor));
    }
}
